/*jslint vars: true, forin: true, sloppy: true */
/*global angular, ocDialog, DM, DialogFactory */

var DF = new DialogFactory('oc-file', '<oc-file></oc-file>');
ocDialog.directive('ocFileOpen', function (ocDialog, $parse) {
	return {
		restrict: 'A',
		scope: {
			opt: "=ocFileOpen"
		},
		link: function (scope, element, attr) {
			element.on("click", function () {
				var o = $parse(attr.ocFileOpen)(scope.$parent);
				ocDialog.file(angular.extend({
					title: '未定义对象名称',
					actionName: '未知',
					actionFn: angular.noop
				}, o), DM.queryDialogByElement(element));
			});
		}
	};
});
